import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:xuance/constant.dart';

void showCommonCenterDialog(String content,
    {GestureTapCallback? onConfirm, GestureTapCallback? onCancel}) {
  Get.dialog(Center(
      child: Container(
          decoration: BoxDecoration(color: Colors.white, borderRadius: br5),
          constraints:
              BoxConstraints(maxWidth: Get.width * 0.8, maxHeight: 160),
          child: Column(children: [
            const Padding(
                padding: EdgeInsets.symmetric(vertical: 10),
                child:
                    Text("提示", style: TextStyle(fontWeight: FontWeight.bold))),
            Expanded(
                child: Padding(
                    padding: const EdgeInsets.all(8.0),
                    child: Center(
                      child: SingleChildScrollView(
                          child: Column(children: [
                        Text(content),
                      ])),
                    ))),
            Row(children: [
              Expanded(
                  child: GestureDetector(
                onTap: () {
                  Get.back();
                  onCancel?.call();
                },
                child: Container(
                    padding: const EdgeInsets.symmetric(vertical: 10),
                    child: Center(
                        child: Text("取消", style: TextStyle(color: c_979797)))),
              )),
              Expanded(
                  child: GestureDetector(
                onTap: () {
                  Get.back();
                  onConfirm?.call();
                },
                child: Container(
                    padding: const EdgeInsets.symmetric(vertical: 10),
                    child: const Center(
                        child: Text(
                      "确定",
                      style: TextStyle(fontWeight: FontWeight.bold),
                    ))),
              ))
            ])
          ]))));
}
